package com.hospital.search.module.message.producer;

import com.hospital.search.module.config.properties.ElasticInsertConsumerProperties;
import com.hospital.search.module.message.Message;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class ElasticInsertProducer {
    @Autowired
    private RocketMQTemplate rocketMQTemplate;
    @Autowired
    private ElasticInsertConsumerProperties properties;

    /**
     * 发送es新增消息
     */
    public SendResult send(Message message) {
        return rocketMQTemplate.syncSend(properties.getTopic(), message);
    }
}
